package imaa.escola.aluno.domain;

import imaa.escola.turma.domain.Turma;
import imaa.escola.util.converter.FlagSimNaoConverter;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "ALUNO_TURMA")
public class AlunoTurma {

	private Long id;
	private Aluno aluno;
	private Turma turma;
	private Double valor;
	private Boolean aulaIndividual;
	private Boolean aulaDomicilio;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "SEQ_ALUNO_TURMA")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "VALOR_AULA")
	public double getValor() {
		return valor;
	}

	public void setValor(Double valor) {
		this.valor = valor;
	}

	@Column(name = "FLG_AULA_INDIVIDUAL")
	@Convert(converter = FlagSimNaoConverter.class)
	public Boolean isAulaIndividual() {
		return aulaIndividual;
	}

	public void setAulaIndividual(Boolean aulaIndividual) {
		this.aulaIndividual = aulaIndividual;
	}

	@Column(name = "FLG_AULA_DOMICILIO")
	@Convert(converter = FlagSimNaoConverter.class)
	public Boolean isAulaDomicilio() {
		return aulaDomicilio;
	}

	public void setAulaDomicilio(Boolean aulaDomicilio) {
		this.aulaDomicilio = aulaDomicilio;
	}

	@ManyToOne(cascade = CascadeType.ALL, targetEntity = Aluno.class)
	@JoinColumn(name = "SEQ_PESSOA_ALUNO")
	public Aluno getAluno() {
		return aluno;
	}

	public void setAluno(Aluno aluno) {
		this.aluno = aluno;
	}

	@ManyToOne(cascade = CascadeType.ALL, targetEntity = Turma.class)
	@JoinColumn(name = "SEQ_TURMA")
	public Turma getTurma() {
		return turma;
	}

	public void setTurma(Turma turma) {
		this.turma = turma;
	}

}
